<template>
	<view>
		<!-- <view class="cu-bar tabbar bg-black fixed  shadow top projectInfoTab"> -->
		<!-- 	<view class="action" @click="NavChange('informationList')" data-cur="informationList">
				<view :class="PageCur=='informationList'?'text-green':'text-gray'">基本信息</view>
			</view>
			<view class="action" @click="NavChange('matterList')" data-cur="matterList">
				<view :class="PageCur=='matterList'?'text-green':'text-gray'">问题清单</view>
			</view> -->
			<!-- <view class="action" @click="NavChange('problemList')" data-cur="problemList">
				<view :class="PageCur=='problemList'?'text-green':'text-gray'">预验收</view>
			</view> -->
		<!-- </view> -->
		
		<cu-custom  :bgColor="'bg-'+$themeColor()">
			<block slot="content">质量评估</block>
		</cu-custom>
		
		<scroll-view scroll-x class="bg-black nav text-center">
			<view class="cu-item" :class="index==TabCur?'text-white cur':''" v-for="(item,index) in 2" :key="index" @tap="tabSelect" :data-id="index">
				<!-- projectNameList{{index}} -->
				{{projectNameList[index]}}
			</view>
		</scroll-view>
		
		<view class="projectConet">
			<informationList v-if="PageCur=='informationList'"></informationList>
			<matterList v-if="PageCur=='matterList'"></matterList>
			<problemList v-if="PageCur=='problemList'"></problemList>
		</view>
	</view>
</template>
<script>
	import {
		mapState
	} from 'vuex';

	export default {
		computed: {
			...mapState(['hasLogin', 'userInfo'])
		},
		data() {
			return {
				id: '',
				projectName: '',
				PageCur: 'informationList',
				index:-1,
				TabCur: 0,
				scrollLeft: 0,
				projectNameList:['基本信息','问题清单'],
			}
		},
		onShow() {
			console.log("onShow")
			this.req();
		},
		onBackPress(options) {
			console.log("onBackPress")
		},
		onLoad: function(options) {
			console.log("onLoad")
			this.id = options.id;
			this.projectName = options.projectName;
		},
		mounted() {
			// 初始化加载
			// console.log(this.hasLogin)
			if (!this.hasLogin) {
				// 如果没有登录，则跳转到登录页面
				uni.navigateTo({
					url: "../login/login"
				})
			}
			console.log("mounted")
		},
		methods: {
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
				this.req();
			},
			req(){
				if(this.TabCur==0){
					this.NavChange("informationList");
				}else if(this.TabCur==1){
					this.NavChange("matterList");
				}
			},
			NavChange: function(e) {
				this.PageCur = e;
			}
		}
	}
</script>

<style>
	.cu-form-group .title {
		min-width: calc(4em + 15px);
	}

	.projectConet {
		margin-top: 40px;
	}

	/* .cu-bar {
		margin-top: 40px;
		padding-top: 0px;
	} */
</style>
